home *** CD-ROM | disk | FTP | other *** search
/ Total Web Page (Professional Suite) / Total Web Page 99.iso / CGI / MAKE_LIST.PL < prev    next >
Perl Script  |  1996-06-03  |  881b  |  50 lines

  1. #!/usr/bin/perl
  2.  
  3. # Create List of URLS From Free For All Link Page
  4. # Created by Matt Wright on 12/15/95
  5. # Version 1.0    Last Modified: 12/15/95
  6. # Usage: make_list.pl <infile> <outfile>
  7.  
  8. $num = @ARGV;
  9.  
  10. if ($num == 2) {
  11.    ($infile,$outfile) = @ARGV;
  12. }
  13. else {
  14.    print "Wrong Number of Arguments!\n\n";
  15.    print "USAGE:\n";
  16.    print "make_list.pl <infile> <outfile>\n";
  17.    print "\n";
  18.    exit;
  19. }
  20.  
  21. if (-e $infile) {
  22.    open(LINKS,$infile);
  23.    @lines = <LINKS>;
  24.    close(LINKS);
  25. }
  26. else {
  27.    print "No Such File: $infile!\n";
  28.    print "\n";
  29.    exit;
  30. }
  31.  
  32. foreach $line (@lines) {
  33.    chop($line);
  34.    if ($line =~ /<a href=\"(.*)\">.*<\/a>/) {
  35.       $cur_url = $1;
  36.       if ($1 =~ /^http:\/\//) {
  37.          push(@URLS,$cur_url);
  38.          $urls++;
  39.       }
  40.    }
  41. }
  42.  
  43. open(DATA,">$outfile");
  44. foreach $url (@URLS) {
  45.    print DATA "$url\n";
  46. }
  47. close(DATA);
  48.  
  49. print "$urls URLs Added To $outfile!\n\n";
  50.